package com.qijian.maindata.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qijian.maindata.domain.PerformanceSummary;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * 车间项目绩效Mapper接口
 *
 * @author qijian
 * @date 2024-08-29
 */
public interface PerformanceSummaryMapper extends BaseMapper<PerformanceSummary> {

    @Select("select count(0) from main_performance_summary WHERE create_time >= CURRENT_DATE ")
    int countCurrentDateWithDel();

    @Update("delete from main_performance_summary where ym=#{yearMonth} and data_type=#{dataType}")
    void deleteByTypeAndMonth(@Param("yearMonth") String yearMonth, @Param("dataType") int dataType);

    @Update("update  main_performance_summary set  final_performance=#{finalPerformance},update_by =#{updateBy} ,update_time =now() where id=#{id} ")
    int updateFinalPerformanceById(@Param("id") Long id, @Param("finalPerformance") BigDecimal finalPerformance,@Param("updateBy")  String updateBy);
}
